package com.yogee.topseller.activity.tianyan;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;

import com.yogee.topseller.R;
import com.yogee.topseller.activity.base.HttpActivity;
import com.yogee.topseller.adapter.DetailAdapter;
import com.yogee.topseller.bean.DetailBean;
import com.yogee.topseller.layout.TitleLayout;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class GrfxDetailActivity extends HttpActivity {

    @BindView(R.id.add_card_titlelayout)
    TitleLayout titlelayout;
    @BindView(R.id.ll_info_detail)
    LinearLayout ll_info_detail;
    @BindView(R.id.rv_detail)
    RecyclerView rv_detail;
    @BindView(R.id.sv_detail)
    ScrollView sv_detail;
    @BindView(R.id.ll_sv)
    LinearLayout ll_sv;

    DetailAdapter detailAdapter = null;
    List<DetailBean> list = new ArrayList<>();

    @Override
    protected int getLayoutId() {
        return R.layout.activity_detail;
    }

    @Override
    protected void initView() {
        titlelayout.setActivity(this);
        titlelayout.setTitle("个人风险");

        for(int i = 0;i<5;i++){
            View v = LayoutInflater.from(this).inflate(R.layout.item_detail, null);
            TextView tv_key = (TextView) v.findViewById(R.id.tv_key);
            TextView tv_value = (TextView) v.findViewById(R.id.tv_value);
            ll_info_detail.addView(v);
        }
        rv_detail.setLayoutManager(new LinearLayoutManager(this));
        detailAdapter = new DetailAdapter(this);
        rv_detail.setAdapter(detailAdapter);
        list.add(new DetailBean());
        list.add(new DetailBean());
        list.add(new DetailBean());
        list.add(new DetailBean());
        list.add(new DetailBean());
        list.add(new DetailBean());
        detailAdapter.addData(list);
        sv_detail.post(new Runnable() {
            @Override
            public void run() {
                sv_detail.scrollTo(0, 0);
            }
        });
    }

}
